#include<bits/stdc++.h>

using namespace std;
int data[1000], head = 500, tail = head - 1;//deque
//queue content: data[head,tail]
//push_from_tail x: data[++tail]=x;
//push_from_head x: data[--head]=x;
//pop_from_head: ++head
//pop_from_tail: --tail;
//query head: data[head]
//query tail:data[tail]
//is empty? head>tail
int main() {
    int n = 13;
    head = 500, tail = head - 1;
    for (int i = n; i >= 1; i--) {
        if (head < tail) {
            int t = data[tail];
            --tail;
            data[--head] = t;
        }

        data[--head] = i;
    }

    while (head <= tail) {
        cout << data[head] << " ";
        head++;
    }
}

